<template>
  <div>
    <h1 style="margin: 20px;">Page not found, will return to homepage in {{ data.time }} seconds.</h1>
  </div>
</template>

<script setup>
import { reactive } from 'vue'
import { useRouter } from 'vue-router'
const router = useRouter()

const data = reactive({
  time: 5
})
const timeoutId = setInterval(() => {
  if (data.time > 0) {
    data.time = data.time - 1
  }
  if (data.time <= 0) {
    router.push('/home')
    clearInterval(timeoutId)
  }
}, 1000)
</script>